﻿using System;
using System.Collections.ObjectModel;
using Entities;

namespace ServicesDirectory.UserControl
{
    public partial class ListVolunteering : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BindData();
        }

        protected void BtnCreate_Click(object sender, EventArgs e)
        {
            Response.Redirect("DetailVolunteer.aspx");
        }

        private void BindData()
        {
            var volunteer = new Collection<Volunteer>
                                {
                                    new Volunteer
                                        {
                                            ContactName = "Contact 1",
                                            Purpose = "Volunteer Purpose 1",
                                            Number = 4,
                                            StartDate = "16/10/2012",
                                            EndDate = "20/11/2012",
                                            IsActive = "Yes"
                                        }
                                };
            if (chkInactive.Checked)
            {
                volunteer.Add(new Volunteer
                                  {
                                      ContactName = "Contact 2",
                                      Purpose = "Volunteer Purpose 2",
                                      Number = 5,
                                      StartDate = "26/11/2012",
                                      EndDate = "20/12/2012",
                                      IsActive = "No"
                                  });
            }
            Repeater1.DataSource = volunteer;
            Repeater1.DataBind();
        }
    }
}